package framework;

import java.awt.Color;
import java.awt.Graphics;

public abstract class Screen {

    public static final int FADE_IN_FADE_OUT = 0;
    public static final int HORIZONTAL_OPEN_CLOSE = 1;
    public static final int VERTICAL_OPEN_CLOSE = 2;
    private static int type = 0;

    private static Screen currentScreen;

    private static int width;
    private static int height;

    // metodos a implementar das subclasses
    public abstract void update();

    public abstract void paint(Graphics g);

    /**
     * Limpa a tela dada uma cor
     * Se nulo, pinta de preto (Color.BLACK)
     * 
     * @param g
     * @param color
     */
    public static void clear(Graphics g, Color color) {
        if (color != null) {
            g.setColor(color);
        } else {
            g.setColor(Color.BLACK);
        }
        g.fillRect(0, 0, Screen.getWidth(), Screen.getHeight());
    }

    public static Screen getCurrentScreen() {
        return currentScreen;
    }

    public static void setCurrentScreen(Screen currentScreen) {
        Screen.currentScreen = currentScreen;
    }

    public static void setCurrentScreen(Screen currentScreen, int type) {
        Screen.type = type;
        GameEngine.setTransitionType(type);
        Screen.currentScreen = currentScreen;
    }

    public static void setTransitionType(int type) {
        Screen.type = type;
        GameEngine.setTransitionType(type);
    }

    public static int getWidth() {
        return width;
    }

    public static void setWidth(int width) {
        Screen.width = width;
    }

    public static int getHeight() {
        return height;
    }

    public static void setHeight(int height) {
        Screen.height = height;
    }
}
